package cn.sccl.common.snmp;

import cn.sccl.dirms.monitor.controller.SnmpController;
import cn.sccl.dirms.monitor.model.Host;
import org.snmp4j.smi.OID;

import java.util.Map;

public class TestSnmp {

    public static void main(String args[]) throws Exception {
        /*SnmpUtils snmpUtils = new SnmpUtils("udp:219.222.189.254/161");

        OID[] columnOids = new OID[] {
                new OID("1.3.6.1.2.1.4.20.1.2")
        };
        snmpUtils.snmpWalk(columnOids);*/

        SnmpController snmpController = new SnmpController();
        Host host = new Host();
        host.setName("219.222.189.254");
        Map<String, Object> reslt = snmpController.getExchangeIPAndPort(host);
        for (String key: reslt.keySet()) {
            Map<String,String> vmap = (Map<String, String>) reslt.get(key);
            String port = vmap.get("port");
            String interfaceStr = vmap.get("interface");
            System.out.println(key + " ----> " + port + " ---->  " + interfaceStr);
        }
    }
}
